import createAxios from '../utils/axios'

// 获取运费关税等信息
export const getSurcharge = () => {
    return createAxios({
        url: '/api/get/order/surcharge',
        method: 'GET',
    }, 'API1', {loading: false});
}

// 获取优惠券
export const getCoupon = () => {
    return createAxios({
        url: '/shop/user_coupon/list',
        method: 'GET',
    }, 'API1', {loading: false});
}

// 生成订单
export const createOrder = (params: any) => {
    return createAxios({
        url: '/shop/order/create',
        method: 'POST',
        data: params
    }, 'API1', {loading: true});
}

//获取stripe的回话id
export const getStripeSessionId = (params: any) => {
    return createAxios({
        url: `/api/stripe/pay/create`,
        method: 'POST',
        data: params,
    }, 'API1');
}

// 获取订单详情
export const getOrderDetail = (id:number) => {
    return createAxios({
        url: `/shop/order/detail?id=${id}`,
        method: 'GET',
    }, 'API1',{loading: false});
}

// 热度商品列表
export const hotGoodsList = () => {
    return createAxios({
        url: `/api/hot/goods?page=1&pagesize=18`,
        method: 'GET',
    }, 'API1', {loading: false});
}
// 订单取消
export const orderCancel = (params:any) => {
    return createAxios({
        url: `/shop/order/cancel`,
        method: 'POST',
        data: params,
    }, 'API1',{loading: false});
}
// 获取优惠券列表
export const getCouponList = (status:number, page:number, limit:number) => {
    return createAxios({
        url: `/shop/userCoupon/list?status=${status}&page=${page}&limit=${limit}`,
        method: 'GET',
    }, 'API1',{loading: false});
}
